package com.handshake.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.handshake.entity.UsersEntity;
import com.handshake.mapper.UsersMapper;
import com.handshake.service.UsersService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 用户表
 *
 * @author LcLee Tankiland@outlook.com
 * @since 1.0.0 2024-10-09
 */
@Service
public class UsersServiceImpl extends ServiceImpl<UsersMapper, UsersEntity> implements UsersService{
    @Autowired
    private UsersMapper usersMapper;
    @Override
    public List<UsersEntity> findByName(String username) {
        QueryWrapper<UsersEntity> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("username", username);
        return usersMapper.selectList(queryWrapper);
    }

    @Override
    public List<UsersEntity> login(UsersEntity users){
        return (List<UsersEntity>) usersMapper.selectOne(new QueryWrapper<>(users));
    };

}